// import adidJson from "@/utils/cascadeData.js"

import { findUserTree } from '@/common/api/base/ha_user.js'

const cascade = {
	namespaced: true,
	state: {
		ZONING: null,
		JURISDIC_LIST: null
	},
	mutations: {
		SET_JURISDIC(state, value) {
			state.JURISDIC_LIST = value
		},
	},
	actions: {
		// 查询登录人管辖单位
		getJurisdic(context, departid) {
			return new Promise(async (resolve, reject) => {
				// 1. 查询登录人管辖单位
				resolve(await findUserTree(departid, { type: 1, isuser: false }))
			}).catch(() => {
				reject('查询赣政通用户信息！')
			})
		}
	}
}
// 初始化行政区划 (南昌)
// cascade.state.ZONING = adidJson.cascadeData.city
// 	.filter(item => item.value == '360000')[0]
// 	.children.filter(el => el.value == '360100')
// console.log('行政区划', cascade.state.ZONING)
// console.log('adidJson.cascadeData.cityLV4', adidJson.cascadeData.cityLV4)
// let jxList = adidJson.cascadeData.cityLV4[0].children[0]
// console.log('jxList', jxList)
// test([jxList])
// function test(data) {
// 	data.map(v => {
// 		console.log(v.value)
// 		if(v.children) {
// 			test(v.children)
// 		}
// 	})
// }

export default cascade